<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
        <div class="float_banner">
            <div class="float_banner_box">
                <span class="float_banner_border float_border_tl"></span>
                <span class="float_banner_border float_border_tr"></span>
                <span class="float_banner_border float_border_bl"></span>
                <span class="float_banner_border float_border_br"></span>
                <a title="填写宝宝资料" id="bar_write_baby_info">
                    <b class="float_banner_write"></b>
                    <span>填写宝宝资料</span>
                </a>
            </div>
    		<div class="float_banner_box">
                <span class="float_banner_border float_border_tl"></span>
                <span class="float_banner_border float_border_tr"></span>
                <span class="float_banner_border float_border_bl"></span>
                <span class="float_banner_border float_border_br"></span>
                <span class="float_banner_tt">在线咨询</span>
                <ul class="float_banner_guiders">
                	<li>
                    	<a class="guide_offline" title="营养导购员" id='yy_man'></a>
                    </li>
                    <li>
                    	<a class="guide_offline" title="扮靓导购员" id='bq_man'></a>
                    </li>
                    <li>
                    	<a class="guide_offline" title="用品导购员" id='yp_man'></a>
                    </li>                    
                    <li>
                    	<a class="guide_offline" title="娱乐导购员" id='yl_man'></a>
                    </li>
                </ul>
            </div>
            <div class="float_banner_box">
                <span class="float_banner_border float_border_tl"></span>
                <span class="float_banner_border float_border_tr"></span>
                <span class="float_banner_border float_border_bl"></span>
                <span class="float_banner_border float_border_br"></span>
                <a href="javascript:doSuggest();" title="投诉建议" id="suggestBt">投诉建议</a>
            </div>
    	</div>
    	<form id="talkForm" method="post">
    	<input type="hidden" name="getAccount" id="getAccount"/>
    	</form>
<script type="text/javascript">
<!--
//打开普通窗口 并返回句柄 
function openWin(url, width, height, name, top, left, params) {
	var name = (typeof(name) != 'undefined') ? name : "";
	var top = (typeof(top) != 'undefined') ? top : (window.screen.availHeight - height) / 2;
	var left = (typeof(left) != 'undefined') ? left : (window.screen.availWidth - width) / 2;
	var params = (typeof(params) != 'undefined') ? params : "toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	return window.open(url, name, "width=" + width + ", height=" + height + ", top=" + top + ", left=" + left + "," + params);
}
//改变点击右边bar填写宝宝资料的响应
function clickWriteBabyInfo(loginFlag){
	if(loginFlag){
		$("#bar_write_baby_info").attr("href","javascript:openWin('${ctx}/frontSys!viewBabyInfo.action',610,560,'宝宝资料');");	
		$("#suggestBt").attr("href","javascript:location.href='${ctx}/frontSys!viewSuggest.action';");	
	}else{
		$("#bar_write_baby_info").attr("href","javascript:location.href='${ctx}/frontSys!viewLogin.action';");	
		$("#suggestBt").attr("href","javascript:location.href='${ctx}/frontSys!viewLogin.action';");	
	}
}

//查询专家列表
function getPro(){	
	var url="${ctx}/frontTalk!getPro.action";
	$.post(url, "" ,function callback(txt){   
			var json = $.parseJSON(txt);			
			if (json.code==0) {	
				var flag1="";
				var flag2="";
				var flag3="";
				var flag4="";
				for(var i=0;i<json.data.length;i++){
					var obj=json.data[i];
					if(obj.type==1){
						flag1=obj.account;
					}else if(obj.type==2){
						flag2=obj.account;
					}else if(obj.type==3){
						flag3=obj.account;
					}else if(obj.type==4){
						flag4=obj.account;
					}
				}	
				setMan(flag1,"yy_man",1);
				setMan(flag2,"bq_man",2);
				setMan(flag3,"yp_man",3);
				setMan(flag4,"yl_man",4);
			}else{
				alert('查询失败！');
			}
		}	
	);	
}
//进入对话框
function checkPro(type){	
	var url="${ctx}/frontTalk!getPro.action";
	$.post(url, "" ,function callback(txt){   
			var json = $.parseJSON(txt);			
			if (json.code==0) {
				var manId="";
				for(var i=0;i<json.data.length;i++){
					var obj=json.data[i];
					if(obj.type==type){
						manId=obj.account;
						break;
					}
				}
				if(manId!=""){
					$('#getAccount').val(manId);
					$('#talkForm').attr("action","${ctx}/frontTalk!goTalk.action");
					$('#talkForm').submit();
				}else{
					alert("很抱歉，导购员刚好下线！");
				}
			}else{
				alert('查询失败！');
			}
		}	
	);	
}
//设置专家在线状态
function setMan(account,aid,type){
	if(account!=""){
		$("#"+aid).attr("href","javascript:checkPro('"+type+"');");
		$("#"+aid).attr("class","guide_online");
	}else{
		$("#"+aid).attr("href","javascript:alert('导购员不在线！非常抱歉！');");
		$("#"+aid).attr("class","guide_offline");
	}
}
getPro();
//setInterval('getPro()',20000);
//-->
</script>    	
